{# LINKS #}
<h3 data-action='toggle-next' data-opened-icon='fa-caret-down' data-closed-icon='fa-caret-right' class='d-inline togglable-section-title' tabindex='0' role='button' aria-expanded='true' aria-controls='linksDiv'><i class='fas fa-caret-down mr-2 fa-fw'></i>{{ 'Links'|trans }}</h3>
<div class='mt-2' data-save-hidden='linksDiv' id='linksDiv'>
  {# EXPERIMENTS LINKS #}
  <h4 data-action='toggle-next' data-opened-icon='fa-caret-down' data-closed-icon='fa-caret-right' class='ml-3 d-inline togglable-section-title' tabindex='0' role='button' aria-expanded='true' aria-controls='experimentsLinksDiv'><i class='fas fa-caret-down mr-2 fa-fw'></i>{{ 'Experiment links'|trans }} (<span id='experimentsLinksCount'>{{ Entity.entityData.experiments_links|length }}</span>)</h4>
  <div id='experimentsLinksDiv' class='ml-4'>
    <div data-count-for='experimentsLinksCount'>
      {% if Entity.entityData.experiments_links %}
        {% for link in Entity.entityData.experiments_links %}
          {% include 'link-view-one.html' %}
        {% endfor %}
      {% endif %}
      {# RELATED EXPERIMENTS #}
      {% if Entity.entityData.related_experiments_links %}
        {% for link in Entity.entityData.related_experiments_links %}
          {% include 'link-view-one.html' with {'isRelated': true} %}
        {% endfor %}
        <div class='mt-2'>
          <a href='experiments.php?mode=show&amp;related={{ Entity.id }}&amp;related_origin={{ Entity.entityType.value }}' class='p-2 rounded hl-hover-gray'><i class='fas fa-list mr-1 fa-fw'></i>{{ 'Show related experiments'|trans }}</a>
        </div>
      {% endif %}
    </div>
    {% if mode == 'edit' %}
      {# ADD LINK #}
      <div class='input-group mt-2'>
        <div class='input-group-prepend'>
          <span class='input-group-text'><i class='fas fa-magnifying-glass'></i></span>
        </div>
        <div class='input-group-prepend' style='max-width:33%;'>
          <select id='addLinkOwnerFilter' class='brl-none brr-none form-control' aria-label='Limit author'>
            <option selected value=''>{{ 'Filter author'|trans }}</option>
            {% for user in usersArr %}
              <option value='{{ user.userid }}'>{{ user.fullname }}</option>
            {% endfor %}
          </select>
        </div>
        <input aria-label='{{ 'Add a link'|trans }}' type='text' data-endpoint='experiments_links' id='addLinkExpInput' class='form-control linkinput' data-id='{{ Entity.id }}' placeholder='{{ 'Add link to an experiment'|trans }}' />
        <div class='input-group-append'>
          <button class='btn btn-primary' type='button' aria-label='{{ 'Add link to an experiment'|trans }}'>{{ 'Add'|trans }}</button>
        </div>
      </div>
    {% endif %}
  </div>
  <hr>

  <h4 data-action='toggle-next' data-opened-icon='fa-caret-down' data-closed-icon='fa-caret-right' class='ml-3 d-inline togglable-section-title' tabindex='0' role='button' aria-expanded='true' aria-controls='itemsLinksDiv'><i class='fas fa-caret-down mr-2 fa-fw'></i>{{ 'Resource links'|trans }} (<span id='itemsLinksCount'>{{ Entity.entityData.items_links|length }}</span>)</h4>
  <div id='itemsLinksDiv' class='ml-4'>
    <div data-count-for='itemsLinksCount'>
      {% if Entity.entityData.items_links %}
        {% for link in Entity.entityData.items_links %}
          {% include 'link-view-one.html' %}
        {% endfor %}
      {% endif %}
      {% if Entity.entityData.related_items_links %}
        {% for link in Entity.entityData.related_items_links %}
          {% include 'link-view-one.html' with {'isRelated': true} %}
        {% endfor %}

        <div class='mt-2'>
          <a href='database.php?mode=show&amp;related={{ Entity.id }}&amp;related_origin={{ Entity.entityType.value }}' class='p-2 rounded hl-hover-gray'><i class='fas fa-list mr-1 fa-fw'></i>{{ 'Show related resources'|trans }}</a>
        </div>
      {% endif %}
      {% if mode == 'edit' %}
        {# ADD LINK #}
        <div class='input-group mt-2'>
          <div class='input-group-prepend'>
            <span class='input-group-text'><i class='fas fa-magnifying-glass'></i></span>
          </div>
          <div class='input-group-prepend' style='min-width: 10%;max-width:33%;'>
            <select id='addLinkCatFilter' class='brr-none brl-none form-control' aria-label='{{ 'Limit category'|trans }}'>
              <option selected value=''>{{ 'Filter category'|trans }}</option>
              {% for cat in App.itemsCategoryArr %}
                <option value='{{ cat.id }}'>{{ cat.title }}</option>
              {% endfor %}
            </select>
          </div>
          <input aria-label='{{ 'Add a link'|trans }}' type='text' data-endpoint='items_links' id='addLinkItemsInput' class='form-control linkinput' data-id='{{ Entity.id }}' placeholder='{{ 'Add link to a resource'|trans }}' />
          <div class='input-group-append'>
            <button class='btn btn-primary' type='button' aria-label='{{ 'Add link to a resource'|trans }}'>{{ 'Add'|trans }}</button>
          </div>
        </div>
      {% endif %}
    </div>
  </div>
  <hr>

  {% include 'compounds-view-edit.html' %}
</div>
<hr>
